package model;

import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.geom.Line2D;
import javax.swing.JPanel;

/**
 *
 * @author Diogo
 */
public class Painel extends JPanel {
    
    public void desenharQuadrado(int x, int y, int largura, int altura, Color cor) {
        Graphics2D g2d = (Graphics2D) this.getGraphics();
        g2d.setColor(cor);
        g2d.fillRect(x, y, largura, altura);
    }
    
    public void desenharLinha(int x1, int y1, int x2, int y2) {
        Graphics2D g2d = (Graphics2D) this.getGraphics();
        g2d.setColor(Color.white);
        Line2D linha = new Line2D.Double(x1, y1, x2, y2);
        g2d.draw(linha);
    }
    
    public void desenharFaixa(int x1, int y1, int x2, int y2) {
        Graphics2D g2d = (Graphics2D) this.getGraphics();
        float dash1[] = {10.0f};
        BasicStroke dashed = new BasicStroke(1.0f, 
                                          BasicStroke.CAP_BUTT, 
                                          BasicStroke.JOIN_MITER, 
                                          10.0f, dash1, 0.0f);
        g2d.setStroke(dashed);
        g2d.setColor(Color.white);
        Line2D linha = new Line2D.Double(x1, y1, x2, y2);
        g2d.draw(linha);
    }
}
